<?php if (!defined('THINK_PATH')) exit();?>

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="__TMPL__Common/style/style.css" />
<script type="text/javascript" src="__TMPL__Common/js/check_dog.js"></script>
<script type="text/javascript" src="__TMPL__Common/js/IA300ClientJavascript.js"></script>
<script type="text/javascript">
	var ACTION_ID ='<?php echo $action_id ?>';
 	var VAR_MODULE = "<?php echo conf("VAR_MODULE");?>";
	var VAR_ACTION = "<?php echo conf("VAR_ACTION");?>";
	var MODULE_NAME	=	'<?php echo MODULE_NAME; ?>';
	var ACTION_NAME	=	'<?php echo ACTION_NAME; ?>';
	var ROOT = '__APP__';
	var ROOT_PATH = '<?php echo APP_ROOT; ?>';
	var CURRENT_URL = '<?php echo trim($_SERVER['REQUEST_URI']);?>';
	var INPUT_KEY_PLEASE = "<?php echo L("INPUT_KEY_PLEASE");?>";
	var TMPL = '__TMPL__';
	var APP_ROOT = '<?php echo APP_ROOT; ?>';
	var LOGINOUT_URL = '<?php echo u("Public/do_loginout");?>';
	var WEB_SESSION_ID = '<?php echo es_session::id(); ?>';
	var EMOT_URL = '<?php echo APP_ROOT; ?>/public/emoticons/';
	var MAX_FILE_SIZE = "<?php echo (app_conf("MAX_IMAGE_SIZE")/1000000)."MB"; ?>";
	var FILE_UPLOAD_URL ='<?php echo u("File/do_upload");?>' ;
	CHECK_DOG_HASH = '<?php $adm_session = es_session::get(md5(conf("AUTH_KEY"))); echo $adm_session["adm_dog_key"]; ?>';
	function check_dog_sender_fun()
	{
		window.clearInterval(check_dog_sender);
		check_dog2();
	}
	var check_dog_sender = window.setInterval("check_dog_sender_fun()",5000);
	
</script>
	<script type="text/javascript" src="__TMPL__Common/js/cropper/jquery.min.js"></script>
<script type="text/javascript" src="__TMPL__Common/js/jquery.timer.js"></script>

<link rel="stylesheet" type="text/css" href="__TMPL__Common/style/weebox.css" />
<script type="text/javascript" src="__TMPL__Common/js/jquery.bgiframe.js"></script>
<script type="text/javascript" src="__TMPL__Common/js/jquery.weebox.js"></script>
<link rel="stylesheet" type="text/css" href="__TMPL__Common/js/cropper/cropper.min.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__Common/js/cropper/main.css" />
<script type="text/javascript" src="__TMPL__Common/js/cropper/cropper.min.js"></script>

<script type="text/javascript" src="__TMPL__Common/js/script.js"></script>
<script type="text/javascript" src="__ROOT__/public/runtime/admin/lang.js"></script>
<script type='text/javascript'  src='__ROOT__/admin/public/kindeditor/kindeditor.js'></script>
<script type='text/javascript'  src='__ROOT__/admin/public/kindeditor/lang/zh_CN.js'></script>


</head>
<body onLoad="javascript:DogPageLoad();">
<div id="info"></div>

<script type="text/javascript" src="__TMPL__Common/js/calendar/calendar.php?lang=zh-cn" ></script>
<link rel="stylesheet" type="text/css" href="__TMPL__Common/js/calendar/calendar.css" />
<script type="text/javascript" src="__TMPL__Common/js/calendar/calendar.js"></script>
<script type="text/javascript" src="__TMPL__Common/js/jquery.weebox.js"></script>
<?php function get_user_diamonds($user_id)
	{
		return M("User")->where("id=".intval($user_id))->getField("diamonds");
	}
	function get_user_coin($user_id)
	{
		return M("User")->where("id=".intval($user_id))->getField("coin");
	}
	function to_user_list($user_id)
	{
		return '<a href="'.U('UserGeneral/index',array('id'=>$user_id)).'">'.$user_id.'</a>';
	}
	function get_promoter_user($child_count,$id)
	{
		if($child_count >0)	{
			return $child_count.'<a href="'.U('BmPromoterUser/index',array('bm_promoter_id'=>$id)).'">明细</a>';
		}else{
			return $child_count;
		}

	}
	function get_promoter_one_name($pid)
	{
		$promoter=M("BmPromoter")->where("user_id=".intval($pid))->find();
		return $child_count.'<a href="'.U('BmPromoterOne/index',array('id'=>$promoter['id'])).'">'.$promoter['name'].'</a>';
	}
	function get_account($user_id){
		return '<a href="javascript:account('.$user_id.')">充值钻石</a>';
	}
	function get_promoter_one_id($pid)
	{
		$promoter=M("BmPromoter")->where("user_id=".intval($pid))->find();

		return $child_count.'<a href="'.U('BmPromoterOne/index',array('id'=>$promoter['id'])).'">'.$promoter['id'].'</a>';
	}

	function get_coins($user_id){
	    $coins=M("User")->where("id=".intval($user_id))->getField("coin");
		$open_game = intval(defined('OPEN_GAME_MODULE') && OPEN_GAME_MODULE);
		$open_diamond = intval(defined('OPEN_DIAMOND_GAME_MODULE') && OPEN_DIAMOND_GAME_MODULE);
		if($open_game && !$open_diamond){
			return "<a href=\"javascript:coins('".$user_id."')\">充值游戏币</a>";
		}
		return "";
	} ?>
<script>
    function account(user_id)
    {
        $.ajax({
            url: ROOT+"?"+VAR_MODULE+"="+MODULE_NAME+"&"+VAR_ACTION+"=account&id="+user_id,
            data: "ajax=1",
            dataType: "json",
            success: function(msg){
                if(msg.status==0){
                    alert(msg.info);
                }
            },
            error: function(){
                $.weeboxs.open(ROOT+'?'+VAR_MODULE+'='+MODULE_NAME+'&'+VAR_ACTION+'=account&id='+user_id, {contentType:'ajax',showButton:false,title:"充值钻石",width:600,height:260});
            }
        });

    }
    function coins(user_id)
    {
        var url = ROOT + "?" + VAR_MODULE + "=Games&" + VAR_ACTION + "=addCoin&user_id=" + user_id;
        $.ajax({
            url: url,
            data: "ajax=1",
            dataType: "json",
            success: function(msg) {
                if (msg.status == 0) {
                    alert(msg.info);
                }
            },
            error: function() {
                $.weeboxs.open(url, {
                    contentType: 'ajax',
                    showButton: false,
                    title: '游戏币管理',
                    width: 600,
                    height: 260
                });
            }
        });
    }
</script>
<div class="main">
<div class="main_title_list"><div class="list-line-ico"></div>二级单位列表</div>
<div class="search_row">
	<form name="search" action="__APP__" method="get">
		<div>二级单位ID：<input type="text" style="width:60px;" class="textbox" name="id" value="<?php echo trim($_REQUEST['id']);?>" /></div>
		<div>二级单位名称：<input type="text" class="textbox" name="name" value="<?php echo trim($_REQUEST['name']);?>" /></div>
		<div>一级单位名称：<input type="text" class="textbox" name="parent_name" value="<?php echo trim($_REQUEST['parent_name']);?>" /></div>
		<div>上级ID：<input type="text" style="width:60px;" class="textbox" name="p_promoter_id" value="<?php echo trim($_REQUEST['p_promoter_id']);?>" /></div>
		<div>手机号：<input type="text" style="width:80px;" class="textbox" name="mobile" value="<?php echo trim($_REQUEST['mobile']);?>" /></div>
		<div>绑定会员ID：<input type="text" style="width:60px;" class="textbox" name="binding_user_id" value="<?php echo trim($_REQUEST['binding_user_id']);?>" /></div>
		<div>状态：
			<select name="is_effect">
				<option value="-1">全部</option>
				<option value="1">有效</option>
				<option value="0">无效</option>
			</select>
		</div>
		<div>创建时间：
			<span><input type="text" class="textbox" style="width:100px;" name="create_time_1" id="create_time_1" value="<?php echo ($_REQUEST['create_time_1']); ?>" onfocus="this.blur(); return showCalendar('create_time_1', '%Y-%m-%d', false, false, 'btn_create_time_1');" /><input type="button" class="button" id="btn_create_time_1" value="<?php echo L("SELECT_TIME");?>" onclick="return showCalendar('create_time_1', '%Y-%m-%d', false, false, 'btn_create_time_1');" /></span>
			- <span><input type="text" class="textbox" style="width:100px;" name="create_time_2" id="create_time_2" value="<?php echo ($_REQUEST['create_time_2']); ?>" onfocus="this.blur(); return showCalendar('create_time_2', '%Y-%m-%d', false, false, 'btn_create_time_2');" /><input type="button" class="button" id="btn_create_time_2" value="<?php echo L("SELECT_TIME");?>" onclick="return showCalendar('create_time_2', '%Y-%m-%d', false, false, 'btn_create_time_2');" /></span>
			<input type="hidden" value="BmPromoterTwo" name="m" />
			<input type="hidden" value="index" name="a" />
			<input type="submit" class="button" value="<?php echo L("SEARCH");?>" />
		</div>

	</form>
</div>
<!-- Think 系统列表组件开始 -->
<table id="dataTable" class="dataTable" cellpadding=0 cellspacing=0 ><tr><td colspan="14" class="topTd" ></td></tr><tr class="row" ><th width="8"><input type="checkbox" id="check" onclick="CheckAll('dataTable')"></th><th><a href="javascript:sortBy('  ','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照<?php echo ($sortType); ?> "><?php if(($order)  ==  "  "): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th width="100px  "><a href="javascript:sortBy('id','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照二级单位ID<?php echo ($sortType); ?> ">二级单位ID<?php if(($order)  ==  "id"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('name','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照二级单位名称  <?php echo ($sortType); ?> ">二级单位名称  <?php if(($order)  ==  "name"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('pid','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照上级一级单位名称  <?php echo ($sortType); ?> ">上级一级单位名称  <?php if(($order)  ==  "pid"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('pid','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照上级ID  <?php echo ($sortType); ?> ">上级ID  <?php if(($order)  ==  "pid"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('mobile','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照手机号  <?php echo ($sortType); ?> ">手机号  <?php if(($order)  ==  "mobile"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('user_id','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照绑定会员ID  <?php echo ($sortType); ?> ">绑定会员ID  <?php if(($order)  ==  "user_id"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('user_id','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照钻石数  <?php echo ($sortType); ?> ">钻石数  <?php if(($order)  ==  "user_id"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('user_id','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照游戏币数  <?php echo ($sortType); ?> ">游戏币数  <?php if(($order)  ==  "user_id"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('child_count','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照发展推广会员/人  <?php echo ($sortType); ?> ">发展推广会员/人  <?php if(($order)  ==  "child_count"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('create_time','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照<?php echo L("CREATE_TIME");?>  <?php echo ($sortType); ?> "><?php echo L("CREATE_TIME");?>  <?php if(($order)  ==  "create_time"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th><a href="javascript:sortBy('is_effect','<?php echo ($sort); ?>','BmPromoterTwo','index')" title="按照<?php echo L("IS_EFFECT");?><?php echo ($sortType); ?> "><?php echo L("IS_EFFECT");?><?php if(($order)  ==  "is_effect"): ?><img src="__TMPL__Common/images/<?php echo ($sortImg); ?>.gif" width="12" height="17" border="0" align="absmiddle"><?php endif; ?></a></th><th width="60px">操作</th></tr><?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): ++$i;$mod = ($i % 2 )?><tr class="row" ><td><input type="checkbox" name="key" class="key" value="<?php echo ($data["id"]); ?>"></td><td><?php echo ($data[""]); ?></td><td><?php echo ($data["id"]); ?></td><td><?php echo ($data["name"]); ?></td><td><?php echo (get_promoter_one_name($data["pid"])); ?></td><td><?php echo (get_promoter_one_id($data["pid"])); ?></td><td><?php echo ($data["mobile"]); ?></td><td><?php echo (to_user_list($data["user_id"])); ?></td><td><?php echo (get_user_diamonds($data["user_id"])); ?></td><td><?php echo (get_user_coin($data["user_id"])); ?></td><td><?php echo (get_promoter_user($data["child_count"],$data['id'])); ?></td><td><?php echo (to_date($data["create_time"])); ?></td><td><?php echo (get_is_effect($data["is_effect"],$data['id'])); ?></td><td class="op_action"><div class="viewOpBox_demo"><a href="javascript:edit('<?php echo ($data["id"]); ?>')"><?php echo L("EDIT");?></a>&nbsp; <?php echo (get_account($data["user_id"])); ?>&nbsp; <?php echo (get_coins($data["user_id"])); ?>&nbsp;</div><a href="javascript:void(0);" class="opration"><span>操作</span><i></i></a></td></tr><?php endforeach; endif; else: echo "" ;endif; ?><tr><td colspan="14" class="bottomTd"> &nbsp;</td></tr></table>
<!-- Think 系统列表组件结束 -->

<div class="page"><?php echo ($page); ?></div>
</div>
</body>
</html>